package com.pulsarwebdevelopment.concordance.plugins;

import java.io.File;
import java.io.FilenameFilter;

public enum FileType{
	TEXT("text/plain", ".txt"),
	HTML("text/html", ".html");
	
	private String mimeType; 
	private FilenameFilter extensionFilter;
	
	FileType(String mimeType, final String ext){
		this.mimeType = mimeType;
		this.extensionFilter = new FilenameFilter() {
			
			public boolean accept(File dir, String filename) {
				return filename.endsWith(ext);
			}
		};
	}
	
	public String getMimeType(){
		return this.mimeType;
	}
	
	public FilenameFilter getFilter(){
		return this.extensionFilter;
	}
	
	public String toString(){
		return getMimeType();
	}
}
